const { defineConfig } = require('@vue/cli-service')
const path = require('path');

const proxyObj = {}
const targetURL = "http://localhost:8088";

proxyObj['/api'] = {
	ws: false,
	target: targetURL,
	changeOrigin: true,
	pathRewrite: {
		'^/api': ''
	}
}


function resolve(dir) {
	return path.join(__dirname, dir)
}

module.exports = defineConfig({
	transpileDependencies: true,

	devServer: {
		host: "localhost",
		port: 8080,
		proxy: proxyObj
	},


	chainWebpack: config => {
		config.module
			.rule('svg')
			.exclude.add(resolve('src/assets/image/icons'))	//svg文件位置
			.end()
		config.module
			.rule('icons')
			.test(/\.svg$/)
			.include.add(resolve('src/assets/image/icons'))	//svg文件位置
			.end()
			.use('svg-sprite-loader')
			.loader('svg-sprite-loader')
			.options({
				symbolId: 'icon-[name]'
			})
			.end()
	},



})